package com.chzc.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * <p>
 * 用户信息表
 * </p>
 *
 * @author CV大魔王
 * @since 2021-05-24
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_user")
@ApiModel(value = "User对象", description = "用户信息表")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户 ID")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "昵称")
    private String nickName;

    @ApiModelProperty(value = "头像url")
    private String imageUrl;

    @ApiModelProperty(value = "注册手机号")
    private String mobile;

    @ApiModelProperty(value = "帐户是否可用(1 可用，0 删除用户)")
    private Integer isEnabled;

    @ApiModelProperty(value = "创建时间")
    private Date createDate;

    @ApiModelProperty(value = "商品抢购折扣")
    @TableField(exist = false)
    private String goodsDiscount;

    public User(String id, String username, String password, String nickName, String imageUrl, String mobile, Integer isEnabled, Date createDate, String goodsDiscount) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.nickName = nickName;
        this.imageUrl = imageUrl;
        this.mobile = mobile;
        this.isEnabled = isEnabled;
        this.createDate = createDate;
        this.goodsDiscount = goodsDiscount;
    }

    public User() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(id, user.id) && Objects.equals(username, user.username) && Objects.equals(password, user.password) && Objects.equals(nickName, user.nickName) && Objects.equals(imageUrl, user.imageUrl) && Objects.equals(mobile, user.mobile) && Objects.equals(isEnabled, user.isEnabled) && Objects.equals(createDate, user.createDate) && Objects.equals(goodsDiscount, user.goodsDiscount);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, username, password, nickName, imageUrl, mobile, isEnabled, createDate, goodsDiscount);
    }
}
